package hhm.javamode.proxy.authority;

import hhm.javamode.base.adduser.IUserService;
import hhm.javamode.base.adduser.UserServiceImpl;

public class UserServiceProxy implements IUserService {
	private UserServiceImpl userServiceImpl;

	public UserServiceProxy(UserServiceImpl userServiceImpl) {
		this.userServiceImpl = userServiceImpl;
	}

	@Override
	public void addUser(String userId, String userName) {

		if (userName.length() > 10) {
			// 如果名字太长，那就不执行，从而实现了权限控制
			System.out.println("名字太长，不允许注册");

		} else {
			userServiceImpl.addUser(userId, userName);

		}

	}

}